import funFetch from '../util/funFetch';

const getWxOpenid = function(params) {
	return funFetch.post('auth/getWxOpenid',
		params
	)
};

const getToken = function() {
	return funFetch.getToken()
};

const login = function () {
    return new Promise((resolve, reject) => {
        uni.login({
            success: res => {
                resolve(res);
                // // 发送 res.code 到后台换取 openId, sessionKey, unionId
                // funFetch.get('/getWeinOpenid', {jscode: res.code}).then(res => {
                //     resolve(res);
                // });
            }
        });
    })
}

export {
	login,
	getWxOpenid,
    getToken
};
